Skip to content

REF: move safe_sort to algos to avoid private/circular dependencies #29384

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 4, 2019

Conversation

jbrockmendel
Copy link
Member

safe_sort uses private functions from core.algorithms and is runtime-imported into core.algorithms. It also doesn't use anything else defined in core.sorting. This move cleans up the dependency structure, in particular is a step towards getting #29133 working.

@jreback
Copy link
Contributor

jreback commented Nov 3, 2019

rather than adding to algos i would put in a separate module
maybe let’s create

pandas/corr/algos/sorting.py, safe_sort.py, algos.py

@jbrockmendel
Copy link
Member Author

pandas/corr/algos

I think we're going to get there before long, yah. There are a few parts of algorithms.py that are inextricably intertwined with Series, but a bunch of it can be made low-dependency with a few tweaks. One of those tweaks is going to be inside safe_sort, which still has a runtime import of Index which I plan to address in the next step. After that is when I was thinking of making core/algos/ a directory

@jreback
Copy link
Contributor

jreback commented Nov 3, 2019

right but rather than moving it twice wouldn’t make sense to move to safe_sort.py now?

@jbrockmendel
Copy link
Member Author

either way i guess. making a new directory and moving a bunch of stuff into it entails updating a lot of other imports

@jreback
Copy link
Contributor

jreback commented Nov 4, 2019

since this is a moving PR, I think doing it here is better (e.g. just move this for now to pandas/core/algos/safe_sort.py), then changing other things can be a follow on

@jreback jreback added the Clean label Nov 4, 2019
@jreback jreback added this to the 1.0 milestone Nov 4, 2019
@jbrockmendel
Copy link
Member Author

since this is a moving PR, I think doing it here is bette

last effort to push back before i go along with this: safe_sort uses private functions from algorithms.py, moving just safe_sort without carefully handling the rest of the module doesn't improve things on that front

@jreback
Copy link
Contributor

jreback commented Nov 4, 2019

since this is a moving PR, I think doing it here is bette

last effort to push back before i go along with this: safe_sort uses private functions from algorithms.py, moving just safe_sort without carefully handling the rest of the module doesn't improve things on that front

ok fine..... but would love the refactor - ok on doing as followons

@jreback jreback merged commit 11476cb into pandas-dev:master Nov 4, 2019
@jbrockmendel jbrockmendel deleted the dagref branch November 4, 2019 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants